<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/jsplib/pubhead.jsp"%>
<%@ page import="net.comm.common.ValueMaping" %>
<%@ taglib uri="/WEB-INF/myTaglib.tld" prefix="tag"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<TITLE>物业服务管理</TITLE>
	<link href="${cpath}/css/youlin.css" rel="stylesheet" type="text/css" media="all" />

	<script type="text/javascript" src="${cpath}/fckeditor/fckeditor.js"></script>
	<SCRIPT src="${cpath}/js/glk_array.js" type=text/javascript></SCRIPT>
	<SCRIPT src="${cpath}/js/glr_array.js" type=text/javascript></SCRIPT>
	<SCRIPT src="${cpath}/js/glfun.js"	   type=text/javascript></SCRIPT>
</head>
<body>
<!--外套 start -->
<div class="wrap">
  <!--页首 start -->
	<%@ include file="/menu.jsp"%>
  <!--页首 end -->  
  
  <!--导航面包屑 start -->
  <div class="breadCrumb">
  <div class="breadCrumbNav">当前位置：<a href="${cpath}/users.do?action=main">我的主页</a> >> <a href="${cpath}/wuye.do?action=home&wuyeID=${theForm.wuyeID}">物业管理处</a> >> <a href="${cpath}/wyserve.do?action=list&qryWuyeID=${theForm.wuyeID}">物业服务列表</a></div>
	<%@ include file="/navf.jsp"%> 
 </div> 
  <!--导航面包屑 end -->
  
  <!--主体 start -->
 <div class="body">
 
  <div class="hotBox1">  
    <div class="hotBox1-left">
      <img src="${cpath}/images/png-0184.png" width="75" height="75"  class="shequ icon user_icon_2">
        <p class="nav">物业服务</p>
      </div>
    <div class="hotBox1-right">
      <p><a href="javascript:history.go(-1);"><img src="${cpath}/images/icon_32.gif" width="137" height="25" /></a></p>
      <p>&nbsp;</p>    
    </div>
  </div> 
   
 <div class="left-Box6">
  <h3>物业服务管理</h3>
  <div class="left-Box6-content">
   <div class="left-Box6-content-inner">   
	 <form action="${cpath}/wyserve.do" name="theForm"  method="post" enctype="multipart/form-data"  class="frmAddTopic">
		<p><label>标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题:</label>
			<input type="text" name='title' value='${theForm.title}' maxlength="100" class="long"/>&nbsp;</p>
		<p><label>内&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;容:</label>
			<textarea name="fck" rows="8" cols="40" >${theForm.content}</textarea></p>
		<p><label>附&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;件:</label>
			<input type="file" name='filepath' value='' class="long" onchange="check_loadfile(this);"  /></p>
		<INPUT id=max_file_size type=hidden value=3096152 name=MAX_FILE_SIZE>
		<IMG id=oFileChecker style="WIDTH: 0px; HEIGHT: 0px" onload=check_photo_size()>
		<!--隐藏域-->
		<input type="hidden" name='seqID'		value=''/>
		<input type="hidden" name='userID'		value='${userID}'/>
		<input type="hidden" name='ntype'		value='${theForm.ntype}'/>
		<input type="hidden" name='wuyeID'		value='${theForm.wuyeID}'/>
		<input type="hidden" name='follID'		value=''/>
		<input type="hidden" name='status'		value='${theForm.status}'/>
		<input type="hidden" name='content'		value=''/>
		<input type="hidden" name='f_ID'		value='${theForm.f_ID}'/>
		<input type="hidden" name='action'		value='add'/>

       <p class="btn">
       <a href="javascript:doConfirm();"><img src="${cpath}/images/icon_09.gif" /></a> 
       <a href="javascript:history.go(-1);"><img src="${cpath}/images/icon_33.gif" /></a>
       </p>
       
     </form>
      </div>
   <div class="clearFloat"></div>
  </div>
</div>
  
    <div class="clearFloat"></div>
 </div> 
 <!--主体 end -->
 
 
 <!--页脚 start -->
	<%@ include file="/foot.jsp"%>
 <!--页脚 end --> 
</div>
<!--外套 end -->

</body>
</html>
<!---->
<script type="text/javascript">
  var oFCKeditor = new FCKeditor('fck');	//传入参数为表单元素（由FCKeditor生成的input或textarea）的name
      oFCKeditor.BasePath='${cpath}/fckeditor/';//指定FCKeditor根路径，也就是fckeditor.js所在的路径
      oFCKeditor.Height='270px';
      oFCKeditor.Width='650px';
      oFCKeditor.ToolbarSet='Demo';				//指定工具栏
	  oFCKeditor.ReplaceTextarea();
</script>
<script>
    /**
     * 检查项目资料维护
     */
	function doConfirm()
	{
		var form = document.theForm;

		var action = form['action'];
		var title = form['title'];
		var content = form['content'];
		var fck = FCKeditorAPI.GetInstance("fck").GetXHTML("true");   

		if(title.value == null||title.value.replace(/(^\s*)|(\s*$)/g,"").length < 1)
  		{
			alert('标题不能为空');
			title.select();
			return ;
		}

		content.value = gjcfilter(fck);
		if(content.length > 30000)
		{
			alert('内容长度不能大于30000,当前长度：' + content.length);
			return ;
		}
		if(content.length < 1 )
		{
			alert('内容不能为空');
			return ;
		}

		var filepath = form['filepath'];
        if(filepath.value != "" && !check_loadfile(filepath))
        {
			return false;
        }	

		form.submit();
	}
	function my_getbyid(id)
	{

		 itm = null;
		 if (document.getElementById)
		 {
			itm = document.getElementById(id);
		 }
		 else if (document.all)
		 {
				itm = document.all[id];
		 }
		 else if (document.layers)
		 {
				itm = document.layers[id];
		 }		 
		 return itm;
	}
	function check_photo_size()
	{
		img_temp = my_getbyid('oFileChecker');
		var limit = parseInt(my_getbyid('max_file_size').value);
		if (img_temp.fileSize > limit) {
			alert("照片文件过大，请选择2M以下的文件上传");
			return false;
		}
	}
	function check_loadfile(filePicker)
	{
		var patn = /.jpg$|.jpeg$|.gif$/i;  
		if(patn.test(filePicker.value)) {
			img_temp = my_getbyid('oFileChecker');
			img_temp.src = filePicker.value;
		} else {

			var patn2 = /.doc$|.xls$|.ppt$|.rar$|.txt$/i;  
			if(!patn2.test(filePicker.value)) {			
				alert('您选择的不是合法的文件,支持文件格式：.jpg/.jpeg/.gif/.doc/.xls/.ppt/.rar/.txt，请重新选择');
				filePicker.value='';
				return false;
			}
		}
		return true;
	}
	/**
   * 根据具体请求设置各个组件状态	
   */
  function showState()
  {
		var action = '${theForm.action}';
		var form = document.theForm;		
		if(action == 'detail')
		{
           
			document.getElementById("back").style.display = "none";
		}
		else if(action == 'modifyPage' || action == 'update')
		{

			form['action'].value = 'update';
		}else{

			form['action'].value = 'add';
		}

	}
	showState();

</script>
